package com.googlecode.worktools.utils;



/**
 * 常用工具类
 * @author Kobe Su,2009-11-18
 */
public class Utils {

    /**
     * 取得字符串的真实长度，一个汉字长度为2.最终度量单位为字符.
     */
    public static int getRealLength(String str) {
        if (str == null) {
            return 0;
        }

        char separator = 256;
        int realLength = 0;

        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i) >= separator) {
                realLength += 2;
            }
            else {
                realLength++;
            }
        }
        return realLength;
    }
    
    
	public static void main(String[] args) {
		String value = "'kobe'";
		value = value.replaceAll("'", "");
		System.out.println(value);
	}

}
